import request from '@/utils/request'

let baseUrl = "/base/admin/contest"

export function list(query) {
  return request({
    url: `${baseUrl}/list`,
    method: 'get',
    params: query
  })
}
export function query(id) {
  return request({
    url: `${baseUrl}/query/${id}`,
    method: 'get',
  })
}

export function getProblemList(id) {
  return request({
    url: `${baseUrl}/getProblemList/${id}`,
    method: 'get',
  })
}

export function getRegisterUserList(params,id) {
  return request({
    url: `${baseUrl}/getRegisterUserList/${id}`,
    method: 'get',
    params: params
  })
}

export function addRegisterUser(data) {
  return request({
    url: `${baseUrl}/addRegisterUser`,
    method: 'post',
    data : data
  })
}

export function addContestProblem(data) {
  return request({
    url: `${baseUrl}/addContestProblem`,
    method: 'post',
    data : data
  })
}

export function updateContestProblem(data) {
  return request({
    url: `${baseUrl}/updateContestProblem`,
    method: 'post',
    data : data
  })
}

export function saveOrUpdate(data) {
  return request({
    url: `${baseUrl}/saveOrUpdate`,
    method: 'post',
    data: data
  })
}



export function del(typeIds) {
  return request({
    url: `${baseUrl}/delete`,
    method: 'delete',
    data:typeIds
  })
}

export function changeStatus(id, status) {
  const data = {
    id,
    status
  }
  return request({
    url: `${baseUrl}/disabled`,
    method: 'put',
    data: data
  })
}



export function uploadProblemCaseZip(data) {
  return request({
    url: `/base/admin/problemCase/uploadProblemCaseZip`,
    method: 'post',
    data: data
  })
}



export function uploadProblemZip(data) {
  return request({
    url: `${baseUrl}/importProblem`,
    method: 'post',
    data: data
  })
}

export function uploadFpsProblem(data) {
  return request({
    url: `${baseUrl}/importFpsProblem`,
    method: 'post',
    data: data
  })
}


export function copyProblem(ids) {
  return request({
    url: `${baseUrl}/copyProblem`,
    method: 'post',
    data:ids
  })
}

export function correctionProblem(problemList) {
  return request({
    url: `${baseUrl}/correctionProblem`,
    method: 'post',
    data:problemList
  })
}



